package cn.doourbest.learnspring.security;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.security.config.annotation.ObjectPostProcessor;
import org.springframework.security.config.annotation.web.HttpSecurityBuilder;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.config.annotation.web.configurers.HttpBasicConfigurer;
import org.springframework.stereotype.Component;

/**
 * @description:
 * @author: zhangsc
 * @create: 2019/12/13
 */
@Component
public class CustomerConfigurer<B extends HttpSecurityBuilder<B>> extends
        AbstractHttpConfigurer<CustomerConfigurer<B>, B> implements ApplicationContextAware {



    private static ApplicationContext applicationContext;

    @Override
    public void configure(B builder) throws Exception {
        super.configure(builder);
        ObjectPostProcessor bean = applicationContext.getBean(ObjectPostProcessor.class);
        System.out.println(1);
    }


    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        CustomerConfigurer.applicationContext = applicationContext;
    }
}
